package ee.serge.shared;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable(detachable="true")
public class Feedback implements IsSerializable {

   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
   String key;
   @Persistent
   private String loanKey;
   @Persistent
   private String ipAddress;
   @Persistent
   private int rating;
   @Persistent
   private String comment;
   @Persistent
   private int agreeCount;
   @Persistent
   private long creationTime = 0;
   
   public Feedback() {}

   public Feedback(String ipAddress, int rating, String comment, int agreeCount, String loanKey) {
      this.ipAddress = ipAddress;
      this.rating = rating;
      this.comment = comment;
      this.agreeCount = agreeCount;
      this.loanKey = loanKey;
   }

   public String getLoanKey() {
   	return loanKey;
   }

	public void setLoanKey(String loanKey) {
   	this.loanKey = loanKey;
   }

	public String getKey() {
      return key;
   }

   public String getIpAddress() {
      return ipAddress;
   }

   public int getRating() {
      return rating;
   }

   public String getComment() {
      return comment;
   }

   public int getAgreeCount() {
      return agreeCount;
   }

   public void setKey(String key) {
      this.key = key;
   }

   public void setIpAddress(String ipAddress) {
      this.ipAddress = ipAddress;
   }

   public void setRating(int rating) {
      this.rating = rating;
   }

   public void setComment(String comment) {
      this.comment = comment;
   }

   public void setAgreeCount(int agreeCount) {
      this.agreeCount = agreeCount;
   }

   public long getCreationTime() {
      return creationTime;
   }

   public void setCreationTime(long creationTime) {
      this.creationTime = creationTime;
   }

	@Override
   public String toString() {
	   return "Feedback [agreeCount=" + agreeCount + ", comment=" + comment
	         + ", creationTime=" + creationTime + ", ipAddress=" + ipAddress
	         + ", key=" + key + ", loanKey=" + loanKey + ", rating=" + rating
	         + "]";
   }

   

}
